package com.hsqn.controller;

import com.hsqn.entity.HealthAndSafety;
import com.hsqn.entity.Result;
import com.hsqn.entity.ServiceRecord;
import com.hsqn.service.ServiceRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/serviceRecord")
@RestController
public class ServiceRecordController {

    @Autowired
    private ServiceRecordService serviceRecordService;


    /**
     * 添加服务
     */
    @PostMapping
    @Operation(
            summary = "添加服务",
            description = "添加服务",
            responses = {
                    @ApiResponse(responseCode = "200", description = "添加成功",
                            content = @Content(schema = @Schema(implementation = HealthAndSafety.class))),
                    @ApiResponse(responseCode = "404", description = "添加失败")
            }
    )
    public Result insertServiceRecord(@RequestBody ServiceRecord serviceRecord) {
        serviceRecordService.insertServiceRecord(serviceRecord);
        return Result.success();
    }

}
